<?php
session_start(); 
include("include/db_connect.php"); 
connect();
$sql="SET CHARACTER SET UTF8";   
query($sql); 
include "include/try_session_login.php";
if($_GET['action']=='active'){

	switch($_GET[status]){

		case"online";
			$data=array("active"=>(0),);	
			update("tb_content_$_GET[prefix]",$data,"id=$_GET[id]");
		break;
			case"offline";
			$data=array("active"=>(1),);
			update("tb_content_$_GET[prefix]",$data,"id=$_GET[id]");
		break;
	}
	
}

if($_GET['action']=='delete'){
	$sql = "select * from tb_content_$_GET[prefix] where id = '".$_GET['id']."'";
	$qr = select($sql);
	$rs = $qr[0];
	delete("tb_content_$_GET[prefix]","id='".$rs['id']."'");
	@unlink("../upload/$rs[image]");
	$sql = "select * from tb_gallery where content_type = '$_GET[prefix]' and content_id = '".$_GET['id']."'";
	$qr = select($sql);
	$total = count($qr);
	$i=0;
	while($i<$total){
		@unlink("../upload/$rs[gallery_name]");
		delete('tb_gallery',"gallery_id='".$rs['gallery_id']."'");
	}
}

if($_GET['action']=='active_user'){

	switch($_GET[status]){

		case"yes";
			$data=array("active"=>(0),);	
			update("tb_$_GET[prefix]",$data,"user_id=$_GET[id]");
		break;
			case"no";
			$data=array("active"=>(1),);
			update("tb_$_GET[prefix]",$data,"user_id=$_GET[id]");
		break;
	}
	
}

if($_GET['action']=='delete_user'){
	
	delete("tb_$_GET[prefix]","user_id='".$_GET['id']."'");
}

?>